//引入api
import{
    requestSearchList
} from "@/api"

//home模块的配置
const state = {
    searchList: {}
}

const mutations  = {
    //1.修改searchList的mutations
    SET_SEARCHLIST_STATE(state , value){
        state.searchList = value
    }
}

const actions = {
    //1.请求商品详情
    async getSearchList({commit} , searchParams){
        const result = await requestSearchList(searchParams)
        commit("SET_SEARCHLIST_STATE" , result)
    }
}

const getters = {
    goodsList(state){
        return state.searchList.goodsList
    },
    trademarkList(state){
        return state.searchList.trademarkList
    },
    attrsList(state){
        return state.searchList.attrsList
    }
}

export default {
    //开启命名空间
    namespaced: true,
    state,
    mutations,
    actions,
    getters,
}